<!DOCTYPE HTML>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="keywords" content="ytu—oj密码找回"/>
    <meta name="description" content="ytu-hustoj密码找回"/>
    <title>hustoj密码重置</title>
    <link rel="stylesheet" type="text/css" href="./main.css"/>
    <style type="text/css">
        .demo {
            width: 400px;
            margin: 40px auto 0 auto;
            min-height: 250px;
        }

        .demo h3 {
            line-height: 24px;
            text-align: center;
            color: #360;
            font-size: 16px
        }

        .demo p {
            line-height: 30px;
            padding: 4px
        }

        .demo p span {
            margin-left: 6px;
            color: #f30
        }

        .input {
            width: 240px;
            height: 24px;
            padding: 2px;
            line-height: 24px;
            border: 1px solid #999
        }

        .btn {
            position: relative;
            overflow: hidden;
            display: inline-block;
            *display: inline;
            padding: 4px 20px 4px;
            font-size: 16px;
            line-height: 20px;
            *line-height: 22px;
            color: #fff;
            text-align: center;
            vertical-align: middle;
            cursor: pointer;
            background-color: #5bb75b;
            border: 1px solid #cccccc;
            border-color: #e6e6e6 #e6e6e6 #bfbfbf;
            border-bottom-color: #b3b3b3;
            -webkit-border-radius: 4px;
            -moz-border-radius: 4px;
            border-radius: 4px;
        }
    </style>
    <script type="text/javascript" src="./jquery-1.7.2.min.js"></script>
    <script type="text/javascript">
        $(function () {
            $("#sub_btn").click(function () {
                var email = $("#email").val();
                var userid = $("#user_id").val();
                var preg = /^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/; //匹配Email
                var pregid = /^[a-zA-Z0-9_-]{3,16}$/;//匹配用户id
                if(!pregid.test(userid)){
                    $("#userchk").html("请正确填写用户名！");
                }else{
                    if (email == '' || !preg.test(email)) {
                        $("#chkmsg").html("请填写正确的邮箱！");
                    } else {
                        $("#sub_btn").attr("disabled", "disabled").val('密码找回邮件发送中...').css("cursor", "default");
                        $.post("sendmail.php", {mail: email,user_id:userid}, function (msg) {
                            if (msg == "noreg") {
                                $("#chkmsg").html("该邮箱尚未注册或信息填写不正确");
                                $("#sub_btn").removeAttr("disabled").val('提 交').css("cursor", "pointer");
                            } else {
                                $(".demo").html("<h3>" + msg + "</h3>");
                            }
                        });
                    }
                }

            });
        })
    </script>
</head>
<body>
<div id="header">
</div>
<div id="main">
    <p style="text-align:center; color:#f30; margin-top:30px">如果邮箱未绑定，请拨打首页电话联系管理员找回密码，找回密码后及时绑定邮箱</p>
    <div class="demo">
        <p><strong>输入先输入您的用户账号：</strong></p>
        <p><input type="text" class="input" name="user_id" id="user_id"><span id="userchk"></span></p>
        <p><strong>输入您注册的电子邮箱，找回密码：</strong></p>
        <p><input type="text" class="input" name="email" id="email"><span id="chkmsg"></span></p>
        <p><input type="button" class="btn" id="sub_btn" value="提 交"></p>
    </div>
</div>
</body>
</html>
